﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <!-- Resource dictionary entries should be defined here. -->
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Colors.xaml"/>
        <ResourceDictionary Source="ScrollViewerStyle.xaml"/>
        <ResourceDictionary Source="TreeViewItemStyle.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type TreeView}">
        <Setter Property="Foreground">
            <Setter.Value>
                <SolidColorBrush Color="{StaticResource Application_TreeviewItem_Foreground}"/>
            </Setter.Value>
        </Setter>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template" Value="{DynamicResource TreeViewTemplate}"/>
        <Setter Property="IsTabStop" Value="True" />
		<Setter Property="ItemContainerStyle" Value="{DynamicResource TreeViewItemStyle}"/>
    </Style>

    <ControlTemplate x:Key="TreeViewTemplate" TargetType="{x:Type TreeView}">
        <Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
    		<Border x:Name="Bd" SnapsToDevicePixels="true" CornerRadius="2">
    			<Border.Background>
                    <SolidColorBrush Color="{StaticResource Application_TreeviewItem_Background}"/>
    			</Border.Background>
    			<ScrollViewer x:Name="ScrollViewer" HorizontalScrollBarVisibility="Auto" 
    				          VerticalScrollBarVisibility="Auto" Background="{x:Null}" 
    				          BorderBrush="Transparent" BorderThickness="0" IsTabStop="False">
    				<ItemsPresenter Margin="5"/>
    			</ScrollViewer>
    		</Border>
    	</Grid>
    </ControlTemplate>
</ResourceDictionary>